{smcl}
{* *! version 1.0 5 Feb 2019}{...}
{vieweralsosee "" "--"}{...}
{vieweralsosee "Help command2 (if installed)" "help command2"}{...}
{viewerjumpto "Syntax" "ssaggregate##syntax"}{...}
{viewerjumpto "Description" "ssaggregate##description"}{...}
{viewerjumpto "Options" "ssaggregate##options"}{...}
{viewerjumpto "Examples" "ssaggregate##examples"}{...}
{title:Title}

{phang}
{bf:ivvam} {hline 2} Instrumental variables (2sls) value-added model estimation


{marker syntax}{...}
{title:Syntax}

{phang}
{cmdab:ivvam} 
{it:varname_dep}
([{it:varlist_endog}]={it:varlist_inst})
[{it:varlist_exog}]
,
{bf:enroll(}{it:varlist}{bf:)}  
[{bf:cluster(}{it:varlist}{bf:)} {bf:dofc}]

{synoptset 20 tabbed}{...}
{synopthdr}
{synoptline}
{syntab:Required}
{synopt:{opt enroll(varlist)}} school enrollment indicators {p_end}

{syntab:Optional}
{synopt:{opt cluster(varname)}} cluster standard errors by {it:varname}{p_end}
{synopt:{opt dofc}} include degrees-of-freedom correction{p_end}
{synoptline}
{p2colreset}{...}
{p 4 6 2}

{marker description}{...}
{title:Description}

{pstd}
{cmd:ivvam} estimates a random-effects instrumental variables model by two-stage least squares, as described in Abdulkadiroglu et al (2019).

{pstd} The outcome variable is given by {it:varname_dep}, and the instruments given by {it:varlist_inst}. Any endogenous and exogenous variables
are given by {it:varlist_endog} and {it:varlist_exog}, respectively. The required {bf:enroll()} option specifies the set of school enrollment indicators.

{marker options}{...}
{title:Options}

{phang}
{opt enroll(varlist)}  specifies a set of mutually-exclusive and exhaustive school enrollment indicators. This option is required {p_end}

{phang}
{opt cluster(varname)}  specifies a variable by which standard errors are clustered. Default standard errors are heteroskedastic-robust. {p_end}

{phang}
{opt dofc}  specifies that a degrees-of-freedom correction be included for the residual variance calculation. {p_end}

{marker stored}{...}
{title:Stored results}

{synoptset 15 tabbed}{...}

{p2col 5 15 19 2: Scalars}{p_end}
{synopt:{cmd:e(N)}} number of observations {p_end}

{p2col 5 15 19 2: Macros}{p_end}
{synopt:{cmd:e(exovar)}} exogenous variables {p_end}
{synopt:{cmd:e(instrm)}} instruments {p_end}
{synopt:{cmd:e(enroll)}} school enrollment indicators {p_end}
{synopt:{cmd:e(depvar)}} outcome variable {p_end}
{synopt:{cmd:e(sigma_VE)}} variance of the estimated residual variance {p_end}
{synopt:{cmd:e(sigma_hat)}} estimated residual variance {p_end}
{synopt:{cmd:e(properties)}} matrices saved in {bf:e()} {p_end}

{p2col 5 15 19 2: Matrices}{p_end}
{synopt:{cmd:e(b)}} coefficient vector {p_end}
{synopt:{cmd:e(V)}} variance-covariance matrix of the estimators {p_end}

{marker examples}{...}
{title:Examples}

{phang}{cmd:. ivvam y w (x1 x2=z_*), enroll(d_*) cluster(id) dofc}

{title:Author}

{phang}Peter Hull, University of Chicago. Email: {browse "mailto:hull@uchicago.edu": hull@uchicago.edu}

{p}

